<template>
  <el-container>
    <el-main>
      <el-row style="height: 200px;overflow-y: auto">
        <el-timeline >
          <el-timeline-item
            v-for="(activity, index) in activities"
            :key="index"
            :timestamp="activity.insertTimeTime">
            <span style="height: 30px;line-height: 40px">{{activity.remark}}</span>
          </el-timeline-item>
        </el-timeline>
      </el-row>
    </el-main>
  </el-container>
</template>

<script>
  import {stateLogList} from '@/api/getData'

  export default {
    name: "index",
    props:{
      cardId:'',
    },
    data() {
      return {
        loading: false,
        tableLoading: false,
        buttonRetryLoading: false,
        activities: [],
        page: {
          current: 1,
          size: 10,
          total: 0
        },

      }
    },
    created() {
      this.cardId = this.$route.query.cardId;
      this.findList()
    },
    methods: {
      findList() {
        this.loading = true;
        this.tableLoading = true;
        if (this.cardNumber === '') {
          this.cardNumber = null
        }
        stateLogList({page: {size: this.page.size,current:this.page.current },cardId: this.cardId }).then(response => {
          this.activities = response.data;
          this.page.total = response.data.length();
          this.loading = false;
          this.tableLoading = false;

        }).catch(e => {
          this.loading = false;
          this.tableLoading = false
        })
      },

      handlePageChange({currentPage, pageSize}) {
        this.page.current = currentPage;
        this.page.size = pageSize;
        this.findList()
      },
      showDetail(row) {
        const h = this.$createElement;
        this.$msgbox({
          title: '查看详情',
          message: h('div', {style: "display:flex;flex-direction: column;white-space:pre-wrap;word-wrap : break-word ;"}, [
            h('span', null, '业务号码：' + row.cardNumber),
            h('span', null, '操作状态：' + row.dictOperaStatus),
            h('span', null, '原因：' + row.reason),
            h('span', null, '最终状态：' + row.dictStatus),
            h('span', null, '请求：' + row.reqBody),
            h('span', null, '响应：' + row.repBody)

          ]),
          confirmButtonText: '确定',

          beforeClose: (action, instance, done) => {
            done();
          }
        }).then(action => {

        });
      },
      load () {
        if(this.page.current<this.maxPage)this.page.current ++
        this.findList();

      }

    },
    props: {
      cardNumber: {
        type: String,
        default: ''
      },
    }
  }
</script>

<style scoped>

</style>
